package com.enation.app.javashop.core.client.fallback.distribution;

import com.enation.app.javashop.core.client.feignimpl.distribution.DistributionGoodsClientFeignImpl;
import com.enation.app.javashop.core.handler.BaseFallbackFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.enation.app.javashop.model.distribution.dos.DistributionGoods;
import org.springframework.stereotype.Component;

/**
 * 分销商品相关熔断 factory
 * @author kingapex
 * @version 1.0
 * @data 2022/5/28 14:08
 **/
@Component

public class DistributionGoodsClientFallbackFactory extends BaseFallbackFactory<DistributionGoodsClientFeignImpl> {
    @Override
    protected DistributionGoodsClientFeignImpl fallback() {
        return new DistributionGoodsClientFallback();
    }

    /**
     * 分销商品相关熔断
     *
     * @author zh
     * @version v7.0
     * @date 18/9/27 上午8:58
     * @since v7.0
     */
    @Component
    public static class DistributionGoodsClientFallback implements DistributionGoodsClientFeignImpl {

        private final Logger logger = LoggerFactory.getLogger(getClass());

        @Override
        public DistributionGoods edit(DistributionGoods distributionGoods) {
            logger.error("修改分销商品提现设置错误,商品ID为" + distributionGoods.getGoodsId());
            return null;
        }

        @Override
        public DistributionGoods getModel(Long goodsId) {
            logger.error("获取分销设置错误,商品ID为" + goodsId);
            return null;
        }

        @Override
        public void delete(Long id) {
            logger.error("删除分销商品提现设置错误,ID为" + id);
        }
    }
}
